import request from '@/utils/request'

// 查询任务分配列表
export function listProcess(query) {
  return request({
    url: '/work/process/user/list',
    method: 'get',
    params: query
  })
}
// 修改完成状态
export function completeStates(itemId,realFinishTime,workId) {
  var data = {
    "itemIds":itemId,
    "realFinishTime":realFinishTime,
    "workId":workId
  }
  return request({
    url: '/work/process/user/finishTime',
    method: 'post',
    data:data
  })
}
// 修改状态
export function completeCheckStates(itemId,state) {
  var data = {
    "itemIds":itemId,
    "state":state
  }
  return request({
    url: '/work/process/user/checkState',
    method: 'post',
    data:data
  })
}


// 查询任务分配详细
export function getProcess(itemId) {
  return request({
    url: '/work/process/user/' + itemId,
    method: 'get'
  })
}

// 新增任务分配
export function addProcessAndResolve(data) {
  return request({
    url: '/work/process/user',
    method: 'post',
    data: data
  })
}

// 修改任务分配
export function updateProcess(data) {
  return request({
    url: '/work/process/user',
    method: 'put',
    data: data
  })
}

// 删除任务分配
export function delProcess(itemId) {
  return request({
    url: '/work/process/user/' + itemId,
    method: 'delete'
  })
}

// 导出任务分配
export function exportProcess(query) {
  return request({
    url: '/work/process/user/export',
    method: 'get',
    params: query
  })
}
//完成任务
export function finishedProcess(itemIds,realFinishTime,workId){
 return request({
    url: '/work/process/user/finishTime',
    method: 'post',
    data: {
      itemIds,realFinishTime,workId
    }
  })
}


// 获取文件列表
export function selectFiles(itemId) {
  return request({
    url: '/work/process/user/files/' + itemId,
    method: 'post',
  })
}


// 删除文件列表
export function deleteFiles(ids) {
  return request({
    url: '/system/file/' + ids,
    method: 'delete',
  })
}

// 文件的下载
export function downloadFile(data) {
  return request({
    url: 'common/File',
    method: 'post',
    data: data
  })
}